﻿namespace EyeOpen.Windows.Serialize
{
	using System;
	using System.IO;
	using System.Windows.Forms;

	internal static class Program
	{
		/// <exception cref="FileNotFoundException">Cannot find specified file.</exception>
		[STAThread]
		private static void Main(string[] args)
		{
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);

			MainForm form;

			if (args.Length > 0)
			{
				var fileName = args[0];

				if (!File.Exists(fileName))
				{
					throw new FileNotFoundException("Cannot find specified file.", fileName);
				}

				form = new MainForm(fileName);
			}
			else
			{
				form = new MainForm(null);
			}
			
			Application.Run(form);
		}
	}
}